/*
 * Copyright © 2004-2014 chenYuan. All rights reserved.
 * @Website:wwww.jspx.net
 * @Mail:39793751@qq.com
 * @author: chenYuan , 陈原
 * @License: Jspx.net Framework Code is open source (LGPL)，Jspx.net Framework 使用LGPL 开源授权协议发布。
 * @jvm:jdk1.6+  x86/amd64
 *
 */
package com.jspx.txweb.dao;

import com.jspx.sober.SoberSupport;
import com.jspx.txweb.IMember;
import com.jspx.txweb.table.*;
import java.sql.SQLException;
import java.util.List;
import java.util.Properties;

/**
 * Created by IntelliJ IDEA.
 * User:chenYuan (mail:39793751@qq.com)
 * Date: 2005-11-12
 * Time: 14:21:24

 */
public interface MemberDAO extends SoberSupport
{

     MemberDept getMemberDept(long uid);
     List<MemberDept> getMemberDeptList(long uid, String sort, int page, int count);
     List<MemberCourt> getMemberCourtList(long uid, String sort, int page, int count);
     MemberCourt getMemberCourt(long uid);
    int getMemberCourtCount(long uid);
    int getMemberDeptCount(long uid);


    int updateMemberDeptDefault(long uid,long id) throws Exception;
    int updateMemberCourtDefault(long uid,long id) throws Exception;

    int getForMailCount(String mail);
    int getForNameCount(String name);
    boolean getIpPrompt(long uid);
    int getMemberCount();
    int getToDayMember();

    String createName(String name);
    boolean checkUserName(String loginId,long uid);

    Member getMember(String loginType,String loginId) throws SQLException;
    Member getForPhone(String name) throws SQLException;
    Member getForId(long uid) throws SQLException;
    Member getLastMember();
    Member getForName(String name) throws SQLException;
    Member getForMail(String mail);
    Member getForKid(String kid);
    Member loadMember(long uid) throws Exception;
    Member getParentMember(long childManId) throws SQLException;
    OAuthOpenId getOAuthOpenId(String namespace, String openId);
    OAuthOpenId getOAuthOpenId(String namespace, long uid);

    boolean congeal( long uid) throws Exception;

    boolean haveUser( long id, int congeal);

    List<Member> getChildList(String[] field,String[] find,long pid,String term,String sortString,int page, int count, boolean load) throws Exception ;

    long getChildCount(String[] field,String[] find,long pid,String term) throws Exception;

    List<Member> getDepartmentMember(TreeItemDAO treeItemDAO,IMember member) throws SQLException;

    List<Member> getDepartmentMember(TreeItemDAO treeItemDAO,String departmentId)  throws SQLException;

    //------------------------------------------------------------------------------------------------------------------
    UserSession getUserSession(long uid) throws Exception;
    UserSession getUserSession(String sessionId) throws Exception;
    int getOnlineCount(String term) throws Exception;
    List<UserSession> getOnlineList(String term, String sort, int page, int count,boolean load) throws Exception;
    boolean deleteSession(String sessionId,long uid) throws Exception;
    boolean deleteOvertimeSession(long overtime);
   // boolean deleteAllSession() throws Exception;
    boolean isOnline(long uid);
    boolean isOnline(String sessionId);
    Properties getFtpAccount() throws Exception;
    //------------------------------------------------------------------------------------------------------------------
    List<Member> getList(String[] field, String[] find,String[] departmentId,String term,String sortString,int page, int count, boolean load) throws Exception;

    long getCount(String[] field, String[] find,String[] departmentId,String term) throws Exception;

    List<Member> getMemberListForRole(int roleId,int page, int count) throws Exception;

    int getMemberListForRoleCount(int roleId) throws Exception;

    //------------------------------------------------------------------------------------------------------------------
    //用户机构设置 begin

    List<Member> getMemberChildList(long memberId,long organizeId,String namespace,int page, int count) throws Exception;

    int getMemberChildCount(long memberId,long organizeId,String namespace) throws Exception;

    List<MemberSpace> getMemberSpaceList(String namespace,int page, int count);

    MemberDetails getMemberDetails(IMember member) throws Exception;

    MemberSpace getMemberSpace(long childId, long organizeId, String namespace) throws Exception;

    boolean isInMemberSpace(long uid, long organizeId, String namespace);

    void markingOnline(List<Member> list) throws Exception;
    //用户机构设置 end
    //------------------------------------------------------------------------------------------------------------------

    boolean deleteOrganizeForMemberSpace(long organizeId, String namespace);
}